|
Cache pollution describes situations where an executing computer program loads data into CPU cache unnecessarily, thus causing other needed data to be evicted from the cache into lower levels of the memory hierarchy, potentially all the way down to main memory, degrading performance. ==Example== Consider the following illustration: T() = T() + 1; for i in 0..SIZEOF(CACHE) C() = C() + 1; T() = T() + C(); (The assumptions here are that the cache is composed of only one level, it is unlocked, the replacement policy is pseudo-LRU, all data is cacheable, the set associativity of the cache is N (where N > 1), and at most one processor register is available to contain program values). Right before the loop starts, T() will be fetched from memory into cache, its value updated. However, as the loop executes, because the number of data elements the loop references requires the whole cache to be filled to its capacity, the cache block containing T() has to be evicted. Thus, the next time the program requests T() to be updated, the cache misses, and the cache controller has to request the data bus to bring the corresponding cache block from main memory again. In this case the cache is said to be "polluted". Changing the pattern of data accesses by positioning the first update of T() between the loop and the second update can eliminate the inefficiency: for i in 0..SIZEOF(CACHE) C() = C() + 1; T() = T() + 1; T() = T() + C(); 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Cache pollution」の詳細全文を読む スポンサード リンク
|